function GAD_Etom_Mobility_vs_Immobility_meanER(Mobility_and_ER_Data_Summary)
%% get mean ER during immobility and mobility in both genotypes
for n = 1:size(Mobility_and_ER_Data_Summary,2)
    if strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-WT')
        WT_Mobility_meanER(n,1) = Mobility_and_ER_Data_Summary(n).Session2_Mean_ER_During_Mobility;
    end
end
WT_Mobility_meanER(WT_Mobility_meanER==0) = nan;
WT_Mobility_meanER(isnan(WT_Mobility_meanER)) = [];

for n = 1:size(Mobility_and_ER_Data_Summary,2)
    if strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-WT')
        WT_Immobility_meanER(n,1) = Mobility_and_ER_Data_Summary(n).Session2_Mean_ER_During_Imobility;
    end
end
WT_Immobility_meanER(WT_Immobility_meanER==0) = nan;
WT_Immobility_meanER(isnan(WT_Immobility_meanER)) = [];




for n = 1:size(Mobility_and_ER_Data_Summary,2)
    if strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-KO')
        KO_Mobility_meanER(n,1) = Mobility_and_ER_Data_Summary(n).Session2_Mean_ER_During_Mobility;
    end
end
KO_Mobility_meanER(KO_Mobility_meanER==0) = nan;
KO_Mobility_meanER(isnan(KO_Mobility_meanER)) = [];

for n = 1:size(Mobility_and_ER_Data_Summary,2)
    if strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-KO')
        KO_Immobility_meanER(n,1) = Mobility_and_ER_Data_Summary(n).Session2_Mean_ER_During_Imobility;
    end
end
KO_Immobility_meanER(KO_Immobility_meanER==0) = nan;
KO_Immobility_meanER(isnan(KO_Immobility_meanER)) = [];


%% Plot histogram

figure
subplot(1,2,1)
histogram(WT_Mobility_meanER, 40, 'BinLimits', [0, 0.2], 'FaceColor', 'r', 'FaceAlpha', 0.5)
hold on
histogram(WT_Immobility_meanER, 40, 'BinLimits', [0, 0.2], 'FaceColor', 'b', 'FaceAlpha', 0.5)
ylim([0,10])
legend('Mobility (> 2cm/sec)', 'Immobility (< 2cm/sec)')
xlabel('mean(Event Rate) (Hz)')
ylabel('Number of Sessions')
set(gca, 'FontSize', 20)
title('p-WT', 'FontSize', 25)
hold off

subplot(1,2,2)
histogram(KO_Mobility_meanER, 40, 'BinLimits', [0, 0.2], 'FaceColor', 'r', 'FaceAlpha', 0.5)
hold on
histogram(KO_Immobility_meanER, 40, 'BinLimits', [0, 0.2], 'FaceColor', 'b', 'FaceAlpha', 0.5)
ylim([0,10])
legend('Mobility (> 2cm/sec)', 'Immobility (< 2cm/sec)')
xlabel('mean(Event Rate) (Hz)')
ylabel('Number of Sessions')
set(gca, 'FontSize', 20)
title('\alpha5-i-KO', 'FontSize', 25)
hold off


end